import threading
import time

def task():
    for i in range(5):
        print(i)
        time.sleep(0.5)

if __name__ == '__main__':
    sub_thread = threading.Thread(target=task)
    sub_thread.daemon = True
    sub_thread.start()
    time.sleep(1)
    print("结束")
    exit()